import pymysql

from common.libs.encrypt import decryption
from server_health import settings

pymysql.install_as_MySQLdb()

for db, value in settings.DATABASES.items():
    password = value.get('PASSWORD')
    if password:
        s, v = decryption(settings.AES_SECRET, password)
        if s is True:
            settings.DATABASES[db]['PASSWORD'] = v
